#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>

#if defined(_WIN32) && defined(_MSC_VER)
#define restrict __restrict
#endif

static inline void swap(int *restrict left, int *restrict right)
{
	if (left == right)
		return;

	int temp = *left;
	*left = *right;
	*right = temp;
}

void random(int *restrict base, int num)
{
	if (base == NULL || num <= 0)
		return;

	for (int i = 0; i < num; ++i)
		base[i] = i + 1;

	for (int i = 0; i < num; ++i)
		swap(base + i, base + rand() % num);
}

#define N 10

int main()
{
	srand((unsigned)time(NULL));
	int array[N];
	random(array, N);

	for (int index = 0; index < N; ++index)
		printf("%d ", array[index]);
	puts("\b");
	return 0;
}
